<template>
	<view class="page">
		<view class="row">
			<view class="label">
				取消绑定原因:
			</view>
			<view class="input" @click="selectShow=true">
				{{form.nobindreason ? form.nobindreason : '请输选择'}}
				<!-- <u-input type="number" v-model="form.nobindreason" readonly placeholder="请输选择"></u-input> -->
			</view>
		</view>
		<view class="row">
			<view class="label">
				原手机号:
			</view>
			<view class="input">
				<u-input type="number" v-model="form.mobilephone" placeholder="请输入原手机号"></u-input>
			</view>
		</view>
		<view class="btn" @click="handleConfirm">
			<text>确定</text>
		</view>
		<u-picker :show="selectShow" :columns="reasonList" 
			@cancel="selectShow = false"	@confirm="selectConfirm"></u-picker>
		
	</view>
</template>

<script>
	import {unbindApi} from '@/common/api/commonApi/commonApi.js'
	export default {
		data() {
			return {
				form:{
					mainframeNo: '',
					memberId : '',
					mobilephone: '',
					nobindreason : '孩子毕业',
				},
				reasonList:[
					['孩子毕业','退出转学','其他原因']
				],
				selectShow : false
			}
		},
		methods: {
			selectConfirm(e){
				console.log(e);
				this.form.nobindreason = e.value[0]
				this.selectShow = false
			},
			handleConfirm(){
				let bool = uni.$u.test.mobile(this.form.mobilephone)
				if(!bool)  return this.setMessage('请输入正确的手机号码')
				unbindApi(this.form).then(res=>{
					uni.clearStorageSync('selectInfoAccount')
					this.setMessage('设置成功！')
					setTimeout(()=>{
						this.goBack()
					},1500)
				})
			}
		},
		onLoad() {
			let info = uni.getStorageSync('selectInfoAccount')
			this.form.memberId = info.id
			this.form.mainframeNo = info.mainframeNo
		},
		onShow() {
			
		},
	}
</script>

<style lang="scss" scoped>
.page{
	background-color: #fff;
	height: 100vh;
	.text{
		color: #333;
	}
	.row{
		display: flex;
		align-items: center;
		height: 90rpx;
		padding: 0 30rpx;
		border-bottom: 2rpx solid #dcdcdc;
		&:nth-child(1){
			border-top: 2rpx solid #dcdcdc;
		}
		.label{
			width: 220rpx;
		}
		.input{
			flex: 1;
			height: 100%;
			display: flex;
			align-items: center;
			.getCodeBtn{
				background-color: #4089f0;
				@include flexCenter;
				color: #fff;
				border-radius: 40rpx;
				height: 52rpx;
				width: 182rpx;
			}
		}
		
	}
	.btn{
		margin: 20rpx auto 0;
		background: #2d8cf6;
		@include flexCenter;
		width: 90vw;
		height: 92rpx;
		border-radius: 10rpx;
		text{
			color: #fff;
		}
	}
	
}
</style>
